<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@page import="java.net.URLDecoder"%>
<%@ page import="com.sz.common.SZUtility" %>
<%@page import="com.sz.business.bmo.IBusinessBMO"%>
<%@page import="com.sz.common.ICommonDAO"%>
<%@page import="com.sz.announce.bmo.IAnnounceBMO"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String business_id = SZUtility.toString(request.getParameter("business_id"));

String style1 = "text-align:right;font-size: 12px;";
String style2 = "width: 220px";

String name = "";
String address = "";
String tel1 = "";
String serial_name = "";
String region_fullname = "";
String room_descrip = "";
String reserve = "";
String low_fee = "";
String order_demand = "";
String service_fee = "";
String card = "";
String avg_fee = "";
String park = "";
String devices = "";
String landmark = "";
String capacity_all = "";
String capacity_mall = "";
String evironment = "";
String area = "";
String service_descrip = "";
String traffic = "";
String deposit_descrip = "";
String comment_text = "";
String special_course = ""; //招牌菜
String crossroad = "";
String flavour = "";
String worktime = "";

String announce = "";

if(!business_id.equals("")) {
	Map map = new HashMap();
	map.put("BUSINESS_ID", business_id);
	ServletContext servletContext = request.getSession().getServletContext(); 
	ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
	IBusinessBMO bmo = (IBusinessBMO)context.getBean("BusinessBMO");	
	List list = bmo.queryBusiness(map);
	if(list.size() > 0) {
		Map r = (Map)list.get(0);
		name			= SZUtility.toString(r.get("NAME"));
		address			= SZUtility.toString(r.get("ADDRESS"));
		tel1			= SZUtility.toString(r.get("TEL1"));
		region_fullname	= SZUtility.toString(r.get("REGION_FULLNAME"));
		serial_name		= SZUtility.toString(r.get("SERIAL_NAME"));
		room_descrip 	= SZUtility.toString(r.get("ROOM_DESCRIP"));
		reserve 		= SZUtility.toString(r.get("RESERVE"));
		low_fee 		= SZUtility.toString(r.get("LOW_FEE"));
		order_demand 	= SZUtility.toString(r.get("ORDER_DEMAND"));
		service_fee		= SZUtility.toString(r.get("SERVICE_FEE"));
		special_course	= SZUtility.toString(r.get("SPECIAL_COURSE"));
		crossroad		= SZUtility.toString(r.get("CROSSROAD"));
		flavour			= SZUtility.toString(r.get("FLAVOUR"));
		worktime		= SZUtility.toString(r.get("WORKTIME"));
		
		String creditcard	= SZUtility.toString(r.get("CREDITCARD_FLAG"));
		if(creditcard.equals("1")) creditcard = "接受信用卡";
		else if(creditcard.equals("0")) creditcard = "不接受信用卡";
		else creditcard = "不详";		
		String consumecard  = SZUtility.toString(r.get("CONSUMECARD_FLAG"));
		if(consumecard.equals("1")) consumecard = "接受信用卡";
		else if(consumecard.equals("0")) consumecard = "不接受信用卡";
		else consumecard = "不详";		
		card			= String.format("信用卡：%s,消费卡:%s", creditcard, consumecard);
		
		String parkflag		= SZUtility.toString(r.get("PARK_FLAG"));
		if(parkflag.equals("1")) parkflag = "有";
		else if(parkflag.equals("0")) parkflag = "无";
		else parkflag = "不详";
		park			= String.format("停车位:%s,说明：%s", parkflag, SZUtility.toString(r.get("PARK_DESCRIP")));
		
		avg_fee			= SZUtility.toString(r.get("AVG_FEE"));		
		devices			= SZUtility.toString(r.get("DEVICES"));
		landmark		= SZUtility.toString(r.get("LANDMARK"));
		capacity_all	= SZUtility.toString(r.get("CAPACITY_ALL"));
		capacity_mall	= SZUtility.toString(r.get("CAPACITY_MALL"));
		evironment		= SZUtility.toString(r.get("ENVIRONMENT"));
		area			= SZUtility.toString(r.get("AREA"));
		service_descrip	= SZUtility.toString(r.get("SERVICE_DESCRIP"));
		traffic			= SZUtility.toString(r.get("TRAFFIC"));
		deposit_descrip	= SZUtility.toString(r.get("DEPOSIT_DESCRIP"));
		comment_text	= SZUtility.toString(r.get("COMMENT_TEXT"));		
	}
	
	Map param = new HashMap();
	param.put("BUSINESS_ID", business_id);
	StringBuffer buf = new StringBuffer();
	IAnnounceBMO annBMO = (IAnnounceBMO)context.getBean("AnnounceBMO");
	List annList = annBMO.queryAnnounce_business_avalid(param);
	for(int i = 0; i < annList.size(); ++i) {
		Map tmp = (Map)annList.get(i);
		String type = SZUtility.toString(tmp.get("TYPE"));
		String title = SZUtility.toString(tmp.get("TITLE"));
		String content = SZUtility.toString(tmp.get("CONTENT"));
		String begin = SZUtility.toString(tmp.get("BEGIN_TIME_STR"));
		String end = SZUtility.toString(tmp.get("END_TIME_STR"));
		
		String type_str = "其他公告：";
		if(type.equals("1")) {
			type_str = "满座公告：";
		} else if(type.equals("2")) {
			type_str = "优惠公告：";
		}
		
		buf.append("<font style=\"color:red;\" >" + type_str + "</font>");
		buf.append("<br/>");
		buf.append("<font style=\"color:red;font-size:12px\" >[" + title + "&nbsp;&nbsp;" + begin + "&nbsp;至&nbsp;" + end + "]</font>");
		buf.append("<br/>");
		buf.append("<font style=\"font-size:12px\" >" + content + "</font>");
		if(i < annList.size()-1) {
			buf.append("<br/>");
			buf.append("<br/>");
		}
	}
	announce = buf.toString();
}

%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
	<link href="<%= request.getContextPath() %>/css/main.css" rel="stylesheet" type="text/css" />
		<base href="<%=basePath%>">

		<title>商家信息</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="business_summary">
		<meta http-equiv="description" content="订单详情" >
	</head>
	
	<body>
		<script type="text/javascript" src="js/calendar.js"></script>
		<script type="text/javascript" src="js/utility.js"></script>
	
	  	 <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
	  	 
	  	 <tr>
	  	 	<th colspan="4" align="left">商家信息</th>
	  	 	<th align="left">公告信息</th>
	  	 </tr>
	  	 
	  	 <tr>
	  	 	<td style="<%=style1%>">商家ID&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="business_id" readonly="readonly" value="<%=business_id%>" >
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">名称&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="name" readonly="readonly" value="<%=name%>" >
	  	 	</td>
	  	 	
	  	 	<td rowspan="12" valign="top" >
	  	 		<br/>
	  	 		<div id="ann_div" style="width:320px;height:320px; border:1px solid #ccc;z-index: 9"><%=announce%></div>
	  	 	</td>
	  	 </tr>
	  	 
	  	 <tr>
	  	 	<td style="<%=style1%>">订餐电话&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="tel1" readonly="readonly" value="<%=tel1%>" >
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">主营菜系&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="serial_name" readonly="readonly" value="<%=serial_name%>" >
	  	 	</td>
	  	 </tr>
	  	 
	  	 <tr>
	  	    <td style="<%=style1%>">招牌菜&nbsp;&nbsp;</td>	  	 	
	  	 	<td style="<%=style2%>; height:70px" >
	  	 		<textarea style="<%=style2%>; height:60px"  id="pecial_course" readonly="readonly" ><%=special_course%></textarea>
	  	 	</td>
	  	 	<td style="<%=style1%>">风味&nbsp;&nbsp;</td>	  	 	
	  	 	<td style="<%=style2%>; height:70px" >
	  	 		<textarea style="<%=style2%>; height:60px" id="lavour"  readonly="readonly" ><%=flavour%></textarea>
	  	 	</td>
	  	 </tr>
	  	 
	  	 <tr>
	  	 	<td style="<%=style1%>">区域&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="region_fullname" readonly="readonly" value="<%=region_fullname%>" >
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">地址&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="address" readonly="readonly" value="<%=address%>" >
	  	 	</td>
	  	 </tr>
	  	 	  	 
	  	 <tr>
	  	    <td style="<%=style1%>">营业时间&nbsp;&nbsp;</td>	  	 	
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="worktime" value="<%=worktime%>" readonly="readonly" />
	  	 	</td>
	  	 	<td style="<%=style1%>">交叉路口&nbsp;&nbsp;</td>	  	 	
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="crossroad" value="<%=crossroad%>" readonly="readonly" />
	  	 	</td>
	  	 </tr>
	  	 
	  	 <tr>	  	 	
		    <td style="<%=style1%>">预订要求&nbsp;&nbsp;</td>
	  	 	<td style="<%=style2%>; height:70px">
	  	 		<textarea style="<%=style2%>; height:60px" id="order_demand" readonly="readonly" ><%=order_demand %></textarea>
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">预订保留时间&nbsp;&nbsp;</td>
	  	 	<td style="<%=style2%>; height:70px">
	  	 		<textarea style="<%=style2%>; height:60px" id="reserve" readonly="readonly" ><%=reserve%></textarea>
	  	 	</td>	  	 	
	  	 </tr>
	  	 <tr>
	  	    <td style="<%=style1%>">包厢描述&nbsp;&nbsp;</td>
	  	 	<td style="<%=style2%>; height:170px" >
	  	 		<textarea style="<%=style2%>; height:160px" id="room_descrip"  readonly="readonly" ><%=room_descrip%></textarea>
	  	 	</td>
	  	 	<td style="<%=style1%>">最低消费&nbsp;&nbsp;</td>
	  	 	<td style="<%=style2%>; height:170px" >
	  	 		<textarea style="<%=style2%>; height:160px" id="low_fee"  readonly="readonly" /><%=low_fee %></textarea>
	  	 	</td>	  	 	
	  	 </tr>
	  	 
	  	 <tr>
	  	 	<td style="<%=style1%>">附加服务费&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="service_fee" value="<%=service_fee %>" readonly="readonly" />
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">信用卡 消费卡&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="card" value="<%=card %>" readonly="readonly" />
	  	 	</td>
	  	 </tr>
	  	 
	  	 <tr>
	  	 	<td style="<%=style1%>">人均消费&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="avg_fee" value="<%=avg_fee %>" readonly="readonly" />
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">停车说明&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="park" value="<%=park %>" readonly="readonly" />
	  	 	</td>
	  	 </tr>
	  	 
	  	 <tr>
	  	 	<td style="<%=style1%>">设施&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="devices" value="<%=devices %>" readonly="readonly" />
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">地标&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="land_mark" value="<%=landmark %>" readonly="readonly" />
	  	 	</td>
	  	 </tr>
	  	 
	  	 <tr>
	  	 	<td style="<%=style1%>">总客容量&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="capacity_all" value="<%=capacity_all %>" readonly="readonly" />
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">大堂客容量&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="capacity_mall" value="<%=capacity_mall %>" readonly="readonly" />
	  	 	</td>
	  	 </tr>
	  	 
	  	 <tr>
	  	 	<td style="<%=style1%>">环境&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="evironment" value="<%=evironment %>" readonly="readonly" />
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">面积&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="area" value="<%=area %>" readonly="readonly" />
	  	 	</td>
	  	 </tr>
	  	 
	  	 <tr>
	  	 	<td style="<%=style1%>">服务&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="service_descrip" value="<%=service_descrip %>" readonly="readonly" />
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">交通路线&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="traffic" value="<%=traffic %>" readonly="readonly" />
	  	 	</td>
	  	 </tr>
	  	 
	  	 <tr>
	  	 	<td style="<%=style1%>">定金说明&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="deposit_descrip" value="<%=deposit_descrip %>" readonly="readonly" />
	  	 	</td>
	  	 	
	  	 	<td style="<%=style1%>">备注&nbsp;&nbsp;</td>
	  	 	<td>
	  	 		<input style="<%=style2%>" type="text" id="comment_text" value="<%=comment_text %>" readonly="readonly" />
	  	 	</td>
	  	 </tr>  			 	
	  	</table>  	

	</body>
</html>
